package main

import (
	"flag"
	"log"
	"os"
)

var tp string
var lport string
var tport string
var host string
var configPath string

func initFlag() {
	flag.StringVar(&tp, "type", "forward", "c for client | s for server | echo for echo | forward for forward")
	flag.StringVar(&lport, "lport", "8889", "the port for listening")
	flag.StringVar(&tport, "tport", "8888", "the port to connect")
	flag.StringVar(&host, "host", "127.0.0.1", "the remote server host to connect")
	flag.StringVar(&configPath, "config", "/default/config.json", "config path")

	flag.Parse()
	if tp == "c" || tp == "forward" {
		if host == "" {
			log.Println("[--host] need be specified!!!")
			os.Exit(0)
		}
	}
	log.Printf("[type]->[%s] [lport]->[%s] [tport]->[%s]\n", tp, lport, tport)
}

func getType() string {
	return tp
}
func getHost() string {
	return host
}
func getLPort() string {
	return lport
}
func getTPort() string {
	return tport
}
func getConfigPath() string {
	return configPath
}
